<ui:composition template="/WEB-INF/templates/main-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">
		
		<h:form id="employeeSearchForm">
			<h:outputText value="Resume Search(Internal)" styleClass="outputTextTitle" />
			<p:panel header="Employee Resume Search "> 
				<h:panelGrid columns="5"  style="margin: 0 auto; width: 100%;" >
					
					<h:panelGroup>
						<h:outputText value="#{msg['module.lable']}" />
						<br />
						<p:selectOneMenu id="modulesMenu" value="#{resumesBean.selectedModule}" styleClass="selectOneMenu168pxFixedWidth" >
							<f:selectItem itemLabel="" itemValue=""/>
							<f:selectItems value="#{resumesBean.modulesMap}"/>
						</p:selectOneMenu>
						<p:watermark for="modulesMenu" value="Select Module" />  
					</h:panelGroup>
				
					<h:panelGroup>
						<h:outputText value="#{msg['location.label']}"  />
						<br />
						<p:inputText id="location" value="#{resumesBean.location}"/>
						<p:watermark for="location" value="Enter Location" />  
					</h:panelGroup>
				
					<h:panelGroup>
						<h:outputText value="Employee Code" />
						<br />
						<p:inputText id="employeeCode" value="#{resumesBean.employeeCode}"/>
						<p:watermark for="employeeCode" value="Enter Employee Code" />  
					</h:panelGroup>
					
					<h:panelGroup>
						<h:outputLabel value="#{msg['employeename.label']}" />
						<br />
						<p:inputText id="employeeName" value="#{resumesBean.employeeName}"/>
						<p:watermark for="employeeName" value="Enter Employee Name" />   
					</h:panelGroup>
					
					<h:panelGroup>
						<br />
						<p:commandButton value="Search" action="#{resumesBean.searchEmployees}" update="@form"/>   
					</h:panelGroup>	
			    </h:panelGrid> 
			
					<!-- Search Result DataList -->
			    <p:dataTable paginator="true" rows="20" id="employeeResumes" value="#{resumesBean.employees}" var="resumes" rendered="#{resumesBean.renderEmployeeList}">  
	  
		            <p:column headerText="Employee Id"> 
		                <h:outputText value="#{resumes.employee.employeeCode}" />
		            </p:column>  
		  
		            <p:column headerText="Employee Name"> 
		                <h:outputText value="#{resumes.employee.firstName} #{resumes.employee.lastName}" />  
		            </p:column> 
		            
		            <p:column headerText="Module Name">
		                <h:outputText value="#{resumes.employee.moduleName}" />  
		            </p:column>  
		            
		            <p:column headerText="Designation">
		                <h:outputText value="#{resumes.employee.designation}" />  
		            </p:column> 
		             
		            <p:column headerText="Mobile No"> 
		                <h:outputText value="#{resumes.employee.telephone}" />
		            </p:column> 
		            
		            <p:column headerText="Email"> 
		                <h:outputText value="#{resumes.employee.email}" />
		            </p:column> 
		             
		            <p:column headerText="Download Resume">  
		               <!--  <p:commandLink id="downloadLink" value="View Profile" ajax="false">  
						    <p:fileDownload value="#{resumesBean.file}" />  
						</p:commandLink>   -->
						
						<p:commandLink  value="Download Resume" actionListener="#{resumesBean.fileDownload}" 
									ajax="false" update="@form" styleClass="downloadResumeCommandLink" style="color:blue;" title="Click to Download Resume">
									  <f:param name="employeeId" value="#{resumes.employee.employeeId}" />
									  <p:fileDownload value="#{resumesBean.file}"></p:fileDownload>
						</p:commandLink>
		            </p:column>  
		        		          
	             </p:dataTable>
	             <h:panelGrid rendered="#{resumesBean.renderNoResult}" >
	             	 <h:outputText value="No search results found ...!" style="color:red; font-weight:bold;" />
	             </h:panelGrid>  
			</p:panel>
		</h:form>
		
	</ui:define>
</ui:composition>